package com.zq.behavior.command;

import java.util.Objects;

public interface Command {
    void execute();
}

abstract class AbstractCommand implements Command {
    protected Receiver receiver;

    protected AbstractCommand(Receiver receiver) {
        this.receiver = Objects.requireNonNull(receiver);
    }
}

class ConcreteCommand extends AbstractCommand {

    public ConcreteCommand(Receiver receiver) {
        super(receiver);
    }

    @Override
    public void execute() {
        receiver.action();
    }
}
